<?php 
session_start();
$uid=$_SESSION['UID'];
$pid=$_SESSION['PID'];
$con=mysql_connect("localhost","root","");
if(!$con)
{
	die("Unable to connect to database");
}
mysql_select_db("se_group2",$con);
$result=mysql_query("SELECT *
		FROM group_student
		WHERE UID=".$uid."
		AND PID=".$pid);
$row=mysql_fetch_array($result);
$gid=$row['GID'];
$_SESSION['GID']=$gid;
if($gid==NULL)
{
	$uri = 'http://';
	$uri .= $_SERVER['HTTP_HOST'];
	header('Location: '.$uri.'/student/nogroup.html');
	exit;
}
else
{
	$uri = 'http://';
	$uri .= $_SERVER['HTTP_HOST'];
	header('Location: '.$uri.'/groups/currentgroup.php');
	exit;
}
?>

